package upload

import (
	"github.com/gin-gonic/gin"
	// log "github.com/sirupsen/logrus"
	"net/http"
	"conf"
)

type Controller struct {
	config *conf.Config
}

// func New(c *gin.Context) *Controller{
func New(config *conf.Config) *Controller{
	controller  := new(Controller)
	// config
	controller.config = config
	return controller
}

func (this *Controller) GetToken(c *gin.Context) {
	res, err := this.config.Oss.GetPolicyToken()
	if err != nil {
		c.JSON(http.StatusOK, gin.H{"success": false, "errno": 1000, "errmsg": err.Error()})
	}else{
		c.JSON(http.StatusOK, gin.H{"success": true, "errno": 0, "data": res})
	}
	return 
}


